﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;

namespace HyMaterialStatistic
{
	public partial class DlgDetailFilter : System.Windows.Forms.Form
	{
		public DlgDetailFilter(string title, List<string> lstFilter, List<int> indexs)
		{
			this.Text = title;
			this.InitializeComponent();
			foreach (string item in lstFilter)
			{
				this.chkDetialInfo.Items.Add(item);
			}
			foreach (int index in indexs)
			{
				this.chkDetialInfo.SetItemChecked(index, true);
			}
		}

		private void btnAll_Click(object sender, EventArgs e)
		{
			for (int i = 0; i < this.chkDetialInfo.Items.Count; i++)
			{
				this.chkDetialInfo.SetItemChecked(i, true);
			}
		}

		private void btnNull_Click(object sender, EventArgs e)
		{
			for (int i = 0; i < this.chkDetialInfo.Items.Count; i++)
			{
				this.chkDetialInfo.SetItemChecked(i, false);
			}
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			this.m_lstDetailFilter.Clear();
			for (int i = 0; i < this.chkDetialInfo.CheckedItems.Count; i++)
			{
				this.m_lstDetailFilter.Add(this.chkDetialInfo.CheckedItems[i].ToString());
			}
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			base.Close();
		}

		public List<string> m_lstDetailFilter = new List<string>();
	}
}
